#! /bin/bash

export minidump_cmd='@bash -c "run_minidump %1 %2 %3"'

function run_minidump
{
    # minidump_stackwalk -s <minidump-file> [symbol-path ...]
    eval "$1" -s  "$3" "$2" > ./dump-report.txt
    xdg-open ./dump-report.txt
}
export -f run_minidump

text=`whereis minidump_stackwalk`
minidump_stackwalk=${text:20}
default_dump_dir=$HOME/.local/share/qeubee/Crashpad/pending/

yad --width=700 --height=200 --no-buttons --window-icon="system-search" \
    --form --field="minidump stackwalk:RO" "${minidump_stackwalk}" \
    --field="符号表目录:DIR" "./" --field="Dump文件:FL" "${default_dump_dir}" \
    --field="开始解析:FBTN" "$minidump_cmd"

exit 0
